<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="s" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Restaurant</title>
<link rel="stylesheet" type="text/css" href='css/sp.css'/>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>

<script type="text/javascript">
	function jsonpCallbackFunction(data){
		alert(data);
	}
	
	
	function callAjax(){
		$.ajax({
			  type: "GET",
			  url: "action/service/menus/abc?name=anuj",
			  contentType: 'application/json',
			  crossdomain : true,
			  data: JSON.stringify({ name: "John", location: "Boston" }),
			  dataType : "jsonp",
			  jsonp : "callback",
			  jsonpCallback : 'jsonpCallbackFunction',
			  error : function(data){
				  alert(data);
			  }
			});
	}
	
	

</script>
</head>
<body>
	<div id="divId"></div>
	<button onclick="callAjax();">call Ajax</button>
	<center>
		<form method="post" action="<c:url value='j_spring_security_check' />">
			<br>
			<br>
			<br>
			<div style="width: 40%; border: 1px solid #000000;">			
				<div style="background-color:#4CC417; text-align: left; padding-left: 5px"><font color="#FFFFFF">Login</font></div>				
				<br>
				You must enter a username and password to login
				<br>
				<table cellspacing="3" cellpadding="5">
					<tr>
						<td align="right"><pre>User Name :</pre></td><td><input type="text" name="j_username"/></td>
					</tr>
					<tr>
						<td align="right"><pre>Password :</pre></td><td><input type="password" name="j_password"/></td>
					</tr>
					<tr>
						<c:if test="${not empty error}">
							<div class="errorblock">
								Your login attempt was not successful, try again.<br /> Caused :
								${sessionScope["SPRING_SECURITY_LAST_EXCEPTION"].message}
							</div>
						</c:if>
					</tr>
					<tr align="right" >
						<td align="right" colspan="2"><input type="submit" value="Login"/></td>
					</tr>
				</table>
			</div>
		</form>
	</center>
</body>
</html>